<?php

    // uncomment the following to define a path alias
    // Yii::setPathOfAlias('local','path/to/local-folder');

    // This is the main Web application configuration. Any writable
    // CWebApplication properties can be configured here.
    return array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'Movie Application',
        'sourceLanguage'=>'vi',
        'language'=>'vi', 
        'theme'=> 'glv',
        'timezone'=>'Asia/Ho_Chi_Minh',
        //'timezone'=>'America/New_York',

        // preloading 'log' component
        'preload'=>array('log'),
        //	'preload'=>array('log'),

        // autoloading model and component classes
        'import'=>array(
            'application.models.*',
            'application.components.*',
            'ext.*',
        ),

        'modules'=>array(
            'web' => array(
                'defaultController' => 'page',
            ), 
            'admin' => array(
                'defaultController' => 'page',
            ), 
            'gii'=>array(
                'class'=>'system.gii.GiiModule',
                'password'=>'123',
                // If removed, Gii defaults to localhost only. Edit carefully to taste.
                //'ipFilters'=>array('127.0.0.16','::1','127.0.0.1'),
            ),
        ),

        //    'controllerMap'=>array(
        //        'httpUser'=>array(
        //            'class'=>'ext.common.HttpAuth.controller.HttpUserController',
        //'userComponent'=>'user',
        //        ),
        //    ),

        // application components
        'components'=>array(
            'crypt'=>array (
                'class'=>'ext.Crypt',
                'key'=>'^*IhgHAIjHGF%^@',
            ),
            'sms'=>array (
                'class'=>'application.components.Sms',
            ),

            'cache'=>array(
                'class' => 'CFileCache',
                'cachePath' => "protected/runtime/cache/",
            ),

            'user'=>array(
                'class' => 'web.components.CustomerWebUser',
                'allowAutoLogin'=>true,
                'loginUrl'=>array('/web/customer/login'),
            ),

            'adminUser'=>array(
                'class' => 'admin.components.AdminWebUser',
                'allowAutoLogin'=>true,
                'loginUrl'=>array('/admin/manager/login'),
            ),

            // end user module

            'errorHandler'=>array(
                // use 'site/error' action to display errors
                'errorAction'=>'/web/page/error',
            ),

            // uncomment the following to enable URLs in path-format
            'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'urlSuffix'=>'', 
                'caseSensitive'=>false,
                'rules'=>require(dirname(__FILE__).'/urlManager_rules.php'),
            ),
            'db'=>require(dirname(__FILE__).'/db.php'),
            // uncomment the following to use a MySQL database
            /*
            'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=testdrive',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            ),
            */

            'log'=>array(
                'class'=>'CLogRouter',
                'routes'=>array(
                    //               array(
                    //                   'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
                    //                   'ipFilters'=>array('113.190.218.165','127.0.0.*'),
                    //               ),
                    //				array(
                    //					'class'=>'CFileLogRoute',
                    //					'levels'=>'error, warning',
                    //				),
                    // uncomment the following to show log messages on web pages
                    //				array(
                    //					'class'=>'CWebLogRoute',
                    //				),
                ),
            ),


            'clientScript'=>array(
                'packages'=>array(
                    'jquery',                
                    //                'jquery'=>array(
                    //                    'baseUrl'=>'//ajax.googleapis.com/ajax/libs/jquery/1/',
                    //                    'js'=>array('jquery.min.js'),
                    //                ),
                    'jquery.ui',   
                ) 
            ),

            'contentCompactor' => array(
                'class' => 'ext.contentCompactor.ContentCompactor',
                'options' => array(
                    // line_break; string; The type of line break used in the HTML that you are processing.
                    // ie, \r, \r\n, \n or PHP_EOL
                    'line_break'                         => PHP_EOL,
                    // preserved_tags; array; An array of html tags whose innerHTML contents format require preserving.
                    'preserved_tags'                    => array('textarea', 'pre', 'script', 'style', 'code'),
                    // preserved_boundry; string; The holding block that is used to replace the contents of the preserved tags
                    // while the compacting is taking place.
                    'preserved_boundry'                    => '@@PRESERVEDTAG@@',
                    // strip_comments; boolean; This will strip html comments from the html. NOTE, if the below option 'keep_conditional_comments'
                    // is not set to true then conditional Internet Explorer comments will also be stripped.
                    'strip_comments'                     => true,
                    // keep_conditional_comments; boolean; Only applies if the baove option 'strip_comments' is set to true.
                    // Only if the client browser is Internet Explorer then the conditional comments are kept.
                    'keep_conditional_comments'            => true,
                    // conditional_boundries; array; The holding block boudries that are used to replace the opening and
                    // closing tags of the conditional comments.
                    'conditional_boundries'                => array('@@IECOND-OPEN@@', '@@IECOND-CLOSE@@'),
                    // compress_horizontal; boolean; Removes horizontal whitespace of the HTML, ie left to right whitespace (spaces and tabs).
                    'compress_horizontal'                => true,
                    // compress_vertical; boolean; Removes vertical whitespace of the HTML, ie line breaks.        
                    'compress_vertical'                    => true,
                    // compress_scripts; boolean; Compresses content from script tags using a simple algorythm. Removes javascript comments,
                    // and horizontal and vertical whitespace. Note as only a simple algorythm is used there are limitations to the script 
                    // and you may want to use a more complex script like 'minify' http://code.google.com/p/minify/ or 'jsmin'
                    // http://code.google.com/p/jsmin-php/ See test3.php for an example.
                    'compress_scripts'                    => false,
                    // script_compression_callback; boolean; The name of a callback for custom js compression. See test3.php for an example.    
                    'script_compression_callback'         => false,
                    // script_compression_callback_args; array; Any additional args for the callback. The javascript will be put to the
                    // front of the array.
                    'script_compression_callback_args'     => array(),
                    // compress_css; boolean; Compresses CSS style tags.        
                    'compress_css'                        => true,
                )
            ),


        ),

        // application-level parameters that can be accessed
        // using Yii::app()->params['paramName']
        'params'=>require(dirname(__FILE__).'/params.php'),
        'defaultController' => '/web/page',

        'onBeginRequest'=>create_function('$event', 'return ob_start("ob_gzhandler");'),
        'onEndRequest'=>create_function('$event', 'return ob_end_flush();'),
    );